wayland: Only bind to supported gtk-shell versions
authorJonas Ådahl <jadahl@gmail.com>
Fri, 6 Mar 2015 02:51:47 +0000 (10:51 +0800)
committerJonas Ådahl <jadahl@gmail.com>
Wed, 11 Mar 2015 03:37:37 +0000 (11:37 +0800)
The gtk-shell Wayland protocol extension is not meant to be backward
compatible right now, so avoid binding to any version that is not the
one supported.

https://bugzilla.gnome.org/show_bug.cgi?id=745721

gdk/wayland/gdkdisplay-wayland.c
gdk/wayland/protocol/gtk-shell.xml

index c5424598bd60c917bca8339ed475bdd86f8af348..21369de2c1b00f48669be8fbb901d8cf4dd2dad9 100644 (file)
@@ -69,6 +69,8 @@
  * ]|
  */
 
+#define SUPPORTED_GTK_SHELL_VERSION 1
+
 static void _gdk_wayland_display_load_cursor_theme (GdkWaylandDisplay *wayland_display);
 
 G_DEFINE_TYPE (GdkWaylandDisplay, gdk_wayland_display, GDK_TYPE_DISPLAY)
@@ -180,9 +182,13 @@ gdk_registry_handle_global (void               *data,
     }
   else if (strcmp (interface, "gtk_shell") == 0)
     {
-      display_wayland->gtk_shell =
-        wl_registry_bind (display_wayland->wl_registry, id, &gtk_shell_interface, 1);
-      _gdk_wayland_screen_set_has_gtk_shell (display_wayland->screen);
+      if (version == SUPPORTED_GTK_SHELL_VERSION)
+        {
+          display_wayland->gtk_shell =
+            wl_registry_bind(display_wayland->wl_registry, id,
+                             &gtk_shell_interface, SUPPORTED_GTK_SHELL_VERSION);
+          _gdk_wayland_screen_set_has_gtk_shell (display_wayland->screen);
+        }
     }
   else if (strcmp (interface, "wl_output") == 0)
     {
index cd6625913b664f39eb6af8c4bdf4116dd2cad938..bed61d6b29d4c727d0788cbd576471eb5c9bfd1e 100644 (file)
@@ -1,12 +1,20 @@
 <protocol name="gtk">
 
   <interface name="gtk_shell" version="1">
+    <description summary="gtk specific extensions">
+      gtk_shell is a protocol extension providing additional features for
+      clients implementing it. It is not backward compatible, and a client must
+      always only bind to the specific version it implements. If a client binds
+      to a version different from the version the server provides, an error will
+      be raised.
+    </description>
+
     <enum name="capability">
       <entry name="global_app_menu" value="1"/>
       <entry name="global_menu_bar" value="2"/>
       <entry name="desktop_icons" value="3"/>
     </enum>
-    
+
     <event name="capabilities">
       <arg name="capabilities" type="uint"/>
     </event>